{extend name="Public/base" /}
{block name="main"}
    <fieldset class="layui-elem-field">
        <legend>分享管理 - 分享列表：<a href="{:U('Customer/index')}">{$customer.user_name}</a></legend>
        <div class="layui-field-box">
            <script type="text/javascript">function goBack(){window.history.back()}</script>
            <span class="layui-btn layui-btn-normal" onclick="goBack()"><i class="layui-icon"></i> 返回</span>
            <!-- <span class="layui-btn layui-btn-normal folder-add"><i class="layui-icon">&#xe608;</i> 新增子目录</span>
            <span class="layui-btn layui-btn-normal file-add"><i class="layui-icon">&#xe608;</i> 上传文件</span> -->
            <table class="layui-table" lay-even>
                <thead>
                <tr>
                    <th>#</th>
                    <th style="width: 30%">目录名</th>
                    <th style="width: 50%">分享链接</th>
                </tr>
                </thead>
                <tbody>
                
                    <tr>
                        <td></td>
                        <td>{$shareList['share_path']}</td>
                        <td><a target="_blank" href="{$shareList['share_link']}">{$shareList['share_link']}</a></td>
                    </tr>
                
                </tbody>
            </table>
        </div>
    </fieldset>
{/block}
{block name="myScript"}
    <script>
        layui.use(['layer'], function() {
            $('.folder-add').on('click', function () {
                layer.open({
                    type: 2,
                    area: ['60%', '60%'],
                    maxmin: true,
                    content: 'folderadd.html?uid={$customer['id']}&parent_folder={$customer['path']}',
                });
            });
            
            $('.file-add').on('click', function () {
                layer.open({
                    type: 2,
                    area: ['60%', '60%'],
                    maxmin: true,
                    content: 'uploadFile.html?uid={$customer['id']}&parent_folder={:urlencode($customer['path'])}',
                });
            });
            
            $('.edit').on('click', function () {
                var ownObj = $(this);
                layer.open({
                    type: 2,
                    area: ['60%', '60%'],
                    maxmin: true,
                    content: ownObj.attr('data-url')
                });
            });
            $('.confirm').on('click', function () {
                var ownObj = $(this);
                layer.confirm(ownObj.attr('data-info'), {
                    btn: ['确定','取消'] //按钮
                }, function(){
                    $.ajax({
                        type: "POST",
                        url: ownObj.attr('data-url'),
                        //data: {id:ownObj.attr('data-id')},
                        success: function(msg){
                            if( msg.code == 1 ){
                                location.reload();
                            }else{
                                layer.msg(msg.msg, {
                                    icon: 5,
                                    shade: [0.6, '#393D49'],
                                    time:1500
                                });
                            }
                        }
                    });
                });
            });
        });
    </script>
{/block}